#ifndef _UIVIEW_H_
#define _UIVIEW_H_

#include <QGraphicsItem>

#include <UIKit/UIResponder.h>
class UIWindow;

class UIViewPrivate;
class UIView : public QGraphicsItem, public UIResponder {
    public:
        UIView (QGraphicsItem *parent = 0);
        ~UIView();

        qreal width (void) const;
        qreal height (void) const;

        QSizeF size (void) const;
        void setSize (const QSizeF& size);
        void setSize (qreal width, qreal height);

        QRectF boundingRect (void) const;
        void setBoundingRect (const QRectF& rect);
        void setBoundingRect (qreal x, qreal y, qreal w, qreal h);

        void removeChildItems (bool destroy = false);

        UIWindow *window (void) const;

    protected:
        virtual void drawRect (QPainter *painter, const QRect& rect);

        virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
        virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
        virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event);

    protected:
        void setUpdatesEnabled (bool enable);

    public:
        void paint (QPainter *painter, 
                    const QStyleOptionGraphicsItem *option,
                    QWidget *widget = 0);

    private:
        UIViewPrivate *d;
};

#endif /* !_UIVIEW_H_ */

